/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cabarrus.xltosql.util;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;

/**
 *
 * @author moscac
 */
public class DBType implements Serializable {

    public DBType() {
    }

    public DBType(int dbType, String dbTypeName) {
        this();
        setDbType(dbType);
        setDbTypeName(dbTypeName);
    }

    public int getDbType() {
        return dbType;
    }

    public void setDbType(int dbType) {
        int oldDbType = this.dbType;
        this.dbType = dbType;
        changeSupport.firePropertyChange("dbType", oldDbType, dbType);
    }

    public String getDbTypeName() {
        return dbTypeName;
    }

    public void setDbTypeName(String dbTypeName) {
        String oldDbTypeName = this.dbTypeName;
        this.dbTypeName = dbTypeName;
        changeSupport.firePropertyChange("dbTypeName", oldDbTypeName, dbTypeName);
    }

    @Override
    public String toString() {
        return getDbTypeName();
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private int dbType = 0;
    private String dbTypeName = "";
}
